// 导入 Vue 和 Vue Router
import { createRouter, createWebHistory } from 'vue-router';

// 导入路由组件
import Home from '../components/Home.vue'
import WeatherSelect from '../components/WeatherSelect.vue';

// 创建路由实例
const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect: '/weather',  
    },
    {
      path: '/weather',
      name: 'Home',
      component: Home,
    },
    {
      path: '/weather/:city',
      name: 'WeatherSelect',
      component: WeatherSelect,
    },
  ],
});

// 导出路由实例
export default router;